package com.jingdianjichi.subject.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * ClassName :ResultCodeEnum
 * Package :com.jingdianjichi.subject.common.enums
 * Desciption :
 *
 * @Author :
 * @Create : 17:44
 * @Version :1.0
 */
@Getter
@AllArgsConstructor
public enum ResultCodeEnum {

    SUCCESS(200, "成功"),
    FAIL(500, "失败");

    private Integer code;
    private String desc;


    public static ResultCodeEnum getByCode(int codeVal) {
        for (ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()) {
            if (resultCodeEnum.code == codeVal) {
                return resultCodeEnum;
            }
        }
        return null;
    }
}






